package com.example.farm.controller;


import com.example.farm.Bean.Land;
import com.example.farm.service.LandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 姚
 * @since 2023-04-15
 */
@RestController
@RequestMapping("/Land")
public class LandController {

    @Autowired
    private LandService landService;

    //更新土地信息
    @RequestMapping(value = "/update",produces = "application/json;charset=UTF-8")
    public int updateLand(@RequestBody(required = false) Land land){
        return landService.updateLand(land);
    }

    //查询所有土地信息
    @RequestMapping(value = "/selectAll",produces = "application/json;charset=UTF-8")
    public ArrayList<Land> selectAll(){
        return landService.selectAll();
    }
    //增加土地信息
    @RequestMapping(value = "/insert",produces = "application/json;charset=UTF-8")
    public int insertLand(@RequestBody(required = false) Land land){
        return landService.insertLand(land);
    }

    //根据uid查询土地信息
    @RequestMapping(value = "/selectByOwnerUid",produces = "application/json;charset=UTF-8")
    public ArrayList<Land> selectByOwnerUid(@RequestBody(required = false) String OwnerUid){
        return landService.selectByOwnerUid(OwnerUid);
    }

}

